import axios from 'axios';
import { logoutFunc } from '../utils/account'
import { BASE_URL } from './config'
import { message } from 'antd';
const request = (options) => {
  return new Promise(function (resolve, reject) {
    axios({
      url: BASE_URL + options.url,
      method: options.method || 'get',
      data: options.params
    }).then((res) => {
      const { data, status } = res;
      if (status >= 200 && status < 300) {
        resolve(data)
      } else {
        message.error(data.message);
        reject(data);
      }
    }).catch((err) => {
      message.error(err)
      reject(err);
    })
  })
}
export default request;
